namespace MicroCloud.CodeGeneration.Database
{
    public class CodeProjectTemplateConfiguration : EntityTypeConfigurationBase<CodeProjectTemplate, Guid>
    {
        /// <summary>重写以实现实体类型各个属性的数据库配置</summary>
        /// <param name="builder">实体类型创建器</param>
        public override void Configuration(EntityTypeBuilder<CodeProjectTemplate> builder)
        {
            builder.HasOne(m => m.Project).WithMany(n => n.ProjectTemplates)
                .HasForeignKey(m => m.ProjectId).SetForeignKey("ProjectId", true);

            builder.HasOne(m => m.Template).WithMany(n => n.ProjectTemplates)
                .HasForeignKey(m => m.TemplateId).SetForeignKey("TemplateId", true);

        }
    }
}